library MarineAttack initializer init requires LegacySystem

	private function CC takes nothing returns boolean
		if GetIssuedOrderId() == ORDER.banish and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
			if GetOrderTarget() == null then
				call IssuePointOrder(GetTriggerUnit(), "attack", GetOrderPointX(),GetOrderPointY())
			else
				call IssueTargetOrder(GetTriggerUnit(), "attack", GetOrderTarget())
			endif
		endif
		return false
	endfunction
	

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger()
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
		call TriggerAddCondition(t,Condition(function CC))
	endfunction

endlibrary